<?php

namespace App\Http\Controllers\Api\Website;


use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Resources\ReleaseResource;
use App\model\ReleaseBail;
use App\model\ReleaseNeed;
use App\Http\Requests\ReleaseRequest;

class ReleaseController extends Controller
{
    //
    //
    public function index(Request $request,$type){

        $bail_type = $request->bail_type;
        $rent_sale = $request->rent_sale;
        $name = $request->name;
        $telephone = $request->telephone;
        $desc = $request->desc;
        if($type == 0){
            $releaseNeed = new ReleaseNeed();
            $releaseNeed->bail_type=$bail_type;
            $releaseNeed->rent_sale=$rent_sale;
            $releaseNeed->name=$name;
            $releaseNeed->telephone=$telephone;
            $releaseNeed->desc=$desc;
            $releaseNeed->save();
        }else{
            $releaseBail = new ReleaseBail();
            $releaseBail->bail_type=$bail_type;
            $releaseBail->rent_sale=$rent_sale;
            $releaseBail->name=$name;
            $releaseBail->telephone=$telephone;
            $releaseBail->desc=$desc;
            $releaseBail->save();
        }
        return response()->json([
            'code'=>0,
            'data'=>'ok',
        ]);
    }
}
